/**####################################################################################
  CLASS : mydojo.dijix.LoginWidget
  ==================================
  - A login widget
  
  ####################################################################################*/
dojo.provide("mydojo.dijix.LoginWidget");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");

dojo.require("mydojo.dijix.TextLink");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.Button");

dojo.declare("mydojo.dijix.LoginWidget", [dijit._Widget, dijit._Templated] , {

		templatePath: dojo.moduleUrl("mydojo.dijix", "template/LoginWidget.html"),
		unTextBox 	: "",
		passTextBox : "",
		loginBtt	: "" ,
		clearBtt	: "" ,
		title		: "",
		// =========================================================================================================
		postCreate: function() {		
			this.inherited(arguments);	
			this.unTextBox 	 = new dijit.form.TextBox( {id:'username' , style:"width:140px" } , this.unTextNode );
			this.passTextBox = new dijit.form.TextBox( {id:'password', type:"password" , style:"width:140px"} , this.passTextNode );
			this.loginBtt	 = new dijit.form.Button ( {label:'Login'} , this.loginBttNode );
			this.clearBtt	 = new dijit.form.Button ( {label:'Clear'} , this.clearBttNode );
			
			dojo.connect( this.loginBtt , "onClick" , this , "login" );
			dojo.connect( this.clearBtt , "onClick" , this , "clearTextBox");
			
			this.titleNode.innerHTML = this.title + " Sign-In";
		},
		clearTextBox: function(){ 
			this.unTextBox.setValue("");
			this.passTextBox.setValue(""); 
		},
		login : function(){
			var username = this.unTextBox.getValue();
			var password = this.passTextBox.getValue();
			_rq.dispatch("login&un="+username+"&pw="+password);
		}
		// =========================================================================================================
});


